// From blog.ubuntu.com
// https://github.com/canonical-web-and-design/blog.ubuntu.com/blob/master/static/sass/styles.scss

@mixin u-insights-crop {
  // Crop to 16:9
  .u-crop--16-9 {
    position: relative;

    &::before {
      content: "";
      display: block;
      padding-top: 56.25%;
      width: 100%;
    }

    // Incase img isn't wrapped in a link
    > a,
    > img {
      bottom: 0;
      left: 0;
      overflow: hidden;
      position: absolute;
      right: 0;
      top: 0;
    }

    > a {
      display: flex;
      flex-direction: column;
      justify-content: center;
      text-align: center;
    }

    img {
      align-self: auto;
    }
  }
}
